package main

import (
	"fmt"
	"strings"
)

//闭包的实践
func main() {

	f := MakeSuffix(".jsp")

	//result:=f("index")
	result := f("index.jsp")
	fmt.Println(result)

}

func MakeSuffix(suffix string) func(string) string {

	return func(name string) string {

		if !strings.HasSuffix(name, suffix) {
			return name + suffix
		}
		return name
	}

}
